import * as echarts from "echarts";
import { getFileNameAndSuffix } from "../utils";

const registeredTheme: string[] = [];
const themeContext = require.context("./", false, /\.json$/);

function register(path: string) {
  const name = getFileNameAndSuffix(path).name;

  registeredTheme.push(name);
  echarts.registerTheme(name, themeContext(path));
}

themeContext.keys().forEach(register);

export { registeredTheme };
